import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {NavbarComponent} from './components/navbar/navbar.component';

import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';


import {BgAnimationComponent} from './components/bg-animation/bg-animation.component';
import {FooterComponent} from './components/footer/footer.component';

// mock数据  start
import {DelonMockModule} from '@delon/mock';
// @ts-ignore
import * as MOCKDATA from '../../_mock';
import {environment} from '../environments/environment';

const MOCKMODULE = !environment.production ? [DelonMockModule.forRoot({data: MOCKDATA})] : [];
// mock数据  end

// import ngx-translate and the http loader  start
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {HttpClient, HttpClientModule} from '@angular/common/http';
// import ngx-translate and the http loader  end

import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';

registerLocaleData(zh);

@NgModule({
  declarations: [
    AppComponent,
    NavbarComponent,
    BgAnimationComponent,
    FooterComponent
  ],
  imports: [
    ...MOCKMODULE,   // mock数据
    BrowserModule,
    AppRoutingModule,
    FontAwesomeModule,   // fontawesome图标
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    }),
    NgZorroAntdModule,
    FormsModule,
    BrowserAnimationsModule
  ],
  providers: [{ provide: NZ_I18N, useValue: zh_CN }],
  bootstrap: [AppComponent]
})
export class AppModule {
}

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http);
}
